<?php


namespace app\controller;


use app\common\controller\ApiController;
use app\model\Curd as CurdModel;

class ModelExample extends ApiController
{
    public function example()
    {
        $model = new CurdModel();
        $where = [['status','=',1]];

        $data = $model->where($where)->limit(1)->select();
        print_r($data);


        //获取单条数据
//        $data = $model->getInfoById(1,'*',true);

        //获取单条数据
//        $data = $model->getInfo($where,'id,title',true);

        //获取单列信息
//        $data = $model->getOneFieldValue($where,'id');

        //更新数据需要影响行数
//        $data = $model->updateNeedAffectedRows(['status'=>1,'title'=>6],['title'=>5]);

        //更新状态
//        $data = $model->updateStatus(1,1,0);

        //单条数据更新
//        $data = $model->updateDataById(1, ['phone' => '13012345678']);

        return ;
    }
}